package awk.loader.class_loader.unloaderclass;

import awk.loader.class_loader.loader.SimpleURLClassLoader;

public class TestClassUnLoad {
    public static void main(String[] args) throws Exception {
        SimpleURLClassLoader loader = new SimpleURLClassLoader();//用自定义的加载器加载A
        Class clazzA = loader.loadClass("testjvm.testclassloader.A");
        Object a = clazzA.newInstance();//清除相关引用
        a = null; //清除该类的实例
        clazzA = null; //清除该class对象的引用
        loader = null; //清楚该类的ClassLoader引用//执行一次gc垃圾回收
        System.gc();
        System.out.println("GC over");
    }
}